import {createBrowserRouter, Navigate} from 'react-router-dom';
import Main from '../pages/main';
import Home from '../pages/home';
import Shop from '../pages/shop';
import User from '../pages/user';
import OtherOne from '../pages/outher/indexOne';
import OtherTwo from '../pages/outher/indexTwo';
import Login from '@/pages/login'

const routes = createBrowserRouter([
    {
        path:'/',
        element: <Main />,
        children:[
            {
                path: '/',
                element: <Navigate to='home' replaces/>
            },
            {
                path:'home',
                // element:<Home />,
                Component:Home,
                meta: {
                    title: '首页'
                }
            },
            {
                path:'shop',
                element:<Shop />,
                meta: {
                    title: '商品管理'
                }
            },
            {
                path:'user',
                element:<User />,
                meta: {
                    title: '用户管理'
                }
            },
            {
                path:'other',
                children:[
                    {
                        path: 'otherOne',
                        element: <OtherOne />,
                        meta: {
                            title: '其他一'
                        }
                    },
                    {
                        path: 'otherTwo',
                        element: <OtherTwo />,
                        meta: {
                            title: '其他二'
                        }
                    },
                ]
            },
            {
                path: '*',
                element: <Navigate to='home' />
            }
        ],
    },
    {
        path: '/login',
        element: <Login />
    }
]);


export default routes;